Skip to content

Basic guide to translation#287

Open
morsssss wants to merge 4 commits intomainfrom
basic-guide
Open

Basic guide to translation#287
morsssss wants to merge 4 commits intomainfrom
basic-guide

Conversation

@morsssss
Copy link
Copy Markdown
Contributor

@morsssss morsssss commented Apr 1, 2026

Also corrected incorrect PHP import in two other docs

Added new page
Added page to docs.json
Updated Overview page, even though I don't think we display that anywhere
correcting error in a couple of other guides
Copilot AI review requested due to automatic review settings April 1, 2026 01:43
@mintlify
Copy link
Copy Markdown
Contributor

mintlify bot commented Apr 1, 2026

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated (UTC)
deepl-c950b784 🟢 Ready View Preview Apr 1, 2026, 1:44 AM

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new “Translation: a beginner’s guide” document and updates the Guides navigation to surface it, alongside small fixes to PHP code snippets in existing getting-started docs.

Changes:

  • Added a new end-to-end beginner guide for /translate, including multi-text examples and model_type guidance.
  • Updated the Guides overview page and docs.json navigation to include the new guide.
  • Updated PHP import lines in two getting-started docs.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
docs/learning-how-tos/examples-and-guides/translation-beginners-guide.mdx New beginner translation guide with multi-language code samples
docs/learning-how-tos/examples-and-guides.mdx Adds a new card entry for the beginner guide in the Guides overview
docs/getting-started/your-first-api-request.mdx Updates PHP snippet import line
docs/getting-started/intro.mdx Updates PHP snippet import line
docs.json Adds the new guide to the Guides navigation ordering

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +69 to +72
For example, if you wanted to translate the phrase “Hello, bright universe!” from German to Japanese:

* “Hello, everybody” is the `text`
* German is the `source_lang`
Copy link

Copilot AI Apr 1, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This example describes translating “Hello, bright universe!” from German and says German is the source_lang, but the sample text is English, the request omits source_lang, and the sample response shows detected_source_language: "EN". Please align the narrative/bullets with the actual request (e.g., change to English/autodetect, or provide German text and include source_lang).

Suggested change
For example, if you wanted to translate the phrase “Hello, bright universe!” from German to Japanese:
* “Hello, everybody” is the `text`
* German is the `source_lang`
For example, if you wanted to translate the phrase “Hello, bright universe!” from English to Japanese, letting DeepL detect the source language automatically:
* “Hello, bright universe!” is the `text`
* the source language (English) is detected automatically, so you can omit `source_lang`

Copilot uses AI. Check for mistakes.
Comment on lines +177 to +180
use DeepL\Client;

$authKey = "{YOUR_API_KEY}"; // replace with your key
$deeplClient = new \DeepL\DeepLClient($authKey);
Copy link

Copilot AI Apr 1, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this PHP sample, use DeepL\\Client; is unused while the code instantiates \\DeepL\\DeepLClient. Either import/use the same class you instantiate (or remove the use), and consider adding require_once 'vendor/autoload.php'; like the other PHP samples so the snippet runs standalone.

Suggested change
use DeepL\Client;
$authKey = "{YOUR_API_KEY}"; // replace with your key
$deeplClient = new \DeepL\DeepLClient($authKey);
require_once 'vendor/autoload.php';
use DeepL\DeepLClient;
$authKey = "{YOUR_API_KEY}"; // replace with your key
$deeplClient = new DeepLClient($authKey);

Copilot uses AI. Check for mistakes.
use DeepL\Client;

$authKey = "{YOUR_API_KEY}"; // replace with your key
$deeplClient = new \DeepL\DeepLClient($authKey);
Copy link

Copilot AI Apr 1, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PHP snippet again imports DeepL\\Client but uses \\DeepL\\DeepLClient. Please make the import/instantiation consistent (or drop the unused use) so readers can copy/paste without confusion.

Suggested change
$deeplClient = new \DeepL\DeepLClient($authKey);
$deeplClient = new Client($authKey);

Copilot uses AI. Check for mistakes.
use DeepL\Client;

$authKey = "{YOUR_API_KEY}"; // replace with your key
$deeplClient = new \DeepL\DeepLClient($authKey);
Copy link

Copilot AI Apr 1, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same issue here: the code imports DeepL\\Client but instantiates \\DeepL\\DeepLClient, leaving the use unused and potentially misleading. Update the import or the instantiated class to match.

Suggested change
$deeplClient = new \DeepL\DeepLClient($authKey);
$deeplClient = new Client($authKey);

Copilot uses AI. Check for mistakes.
```php Sample request
require_once 'vendor/autoload.php';
use DeepL\Translator;
use DeepL\Client;
Copy link

Copilot AI Apr 1, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PHP example now imports DeepL\\Client, but the snippet never uses Client and instead instantiates \\DeepL\\DeepLClient. Please update the import to match the instantiated class (or remove the unused use) so the sample is internally consistent.

Suggested change
use DeepL\Client;

Copilot uses AI. Check for mistakes.
Comment on lines +107 to 110
use DeepL\Client;

$authKey = "f63c02c5-f056-..."; // Replace with your key
$deeplClient = new \DeepL\DeepLClient($authKey);
Copy link

Copilot AI Apr 1, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This snippet imports DeepL\\Client, but then instantiates \\DeepL\\DeepLClient, so the use is unused and the sample is inconsistent. Please either import DeepL\\DeepLClient (and instantiate without a leading \\), or remove the unused import.

Suggested change
use DeepL\Client;
$authKey = "f63c02c5-f056-..."; // Replace with your key
$deeplClient = new \DeepL\DeepLClient($authKey);
use DeepL\DeepLClient;
$authKey = "f63c02c5-f056-..."; // Replace with your key
$deeplClient = new DeepLClient($authKey);

Copilot uses AI. Check for mistakes.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants